import java.util.Scanner;

public class demo04 {
    //全球变暖
    public static int count=0;
    public static int[] dx={0,1,0,-1};
    public static int[] dy={1,0,-1,0};
    public static int flag=0;
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String[] arr1=new String[n];
        char[][] arr=new char[n][n];
        for (int i = 0; i < n; i++) {
            arr1[i]=sc.next();
            arr[i]=arr1[i].toCharArray();
        }
        int[][] num=new int[n][n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if(arr[i][j]=='#'&&num[i][j]==0){
                    flag=0;
                    dfs(arr,i,j,num);
                    if(flag==0){
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    }
    public static void dfs(char[][] arr,int i,int j,int[][] num){
        num[i][j]=1;
        if(arr[i][j-1]=='#'&&arr[i][j+1]=='#'&&arr[i+1][j]=='#'&&arr[i-1][j]=='#'){
            flag=1;
        }
        for (int k = 0; k < 4; k++) {
            int x=i+dx[k];
            int y=j+dy[k];
            if(arr[x][y]=='#'&&num[x][y]==0){
                dfs(arr,x,y,num);
            }
        }
    }
}
//. . . . . . .
//. # # . . . .
//. # # . . . .
//. . . . # # .
//. . # # # # .
//. . . # # # .
//. . . . . . .